import axios from 'axios'
export const gettoken = async () => {
    var newtoken
    var oldtoken = localStorage.getItem('access_token')
    try{
        let res = await axios.post('http://39.108.122.107:1111/api/refresh',{},{headers:{'Authorization':'Bearer'+oldtoken}})
        newtoken = res.data.access_token
        localStorage.setItem('access_token',newtoken)
    }catch(err){
        newtoken = '',
        console.log(err.response,'commen')
    }
    return newtoken
}
